package com.wyzz.hr.pojo.base;

import java.io.Serializable;
import java.util.Set;
import java.util.TreeSet;

import com.wyzz.hr.pojo.Infoclass;
import com.wyzz.hr.pojo.Information;

public abstract class BaseInfoclass implements Serializable {

	public BaseInfoclass() {
		hashCode = 0x80000000;
		initialize();
	}

	public BaseInfoclass(String id) {
		hashCode = 0x80000000;
		setId(id);
		initialize();
	}

	public BaseInfoclass(String id, String infoclassName,
			Integer infoclassSortId, Integer infoclassStatus) {
		hashCode = 0x80000000;
		setId(id);
		setInfoclassName(infoclassName);
		setInfoclassSortId(infoclassSortId);
		setInfoclassStatus(infoclassStatus);
		initialize();
	}

	protected void initialize() {
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
		hashCode = 0x80000000;
	}

	public String getInfoclassName() {
		return infoclassName;
	}

	public void setInfoclassName(String infoclassName) {
		this.infoclassName = infoclassName;
	}

	public Integer getInfoclassSortId() {
		return infoclassSortId;
	}

	public void setInfoclassSortId(Integer infoclassSortId) {
		this.infoclassSortId = infoclassSortId;
	}

	public Integer getInfoclassStatus() {
		return infoclassStatus;
	}

	public void setInfoclassStatus(Integer infoclassStatus) {
		this.infoclassStatus = infoclassStatus;
	}

	public Set getInformations() {
		return informations;
	}

	public void setInformations(Set informations) {
		this.informations = informations;
	}

	public void addToinformations(Information information) {
		if (null == getInformations())
			setInformations(new TreeSet());
		getInformations().add(information);
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof Infoclass))
			return false;
		Infoclass infoclass = (Infoclass) obj;
		if (null == getId() || null == infoclass.getId())
			return false;
		else
			return getId().equals(infoclass.getId());
	}

	public int hashCode() {
		if (0x80000000 == hashCode) {
			if (null == getId())
				return super.hashCode();
			String hashStr = (new StringBuilder()).append(getClass().getName())
					.append(":").append(getId().hashCode()).toString();
			hashCode = hashStr.hashCode();
		}
		return hashCode;
	}

	public String toString() {
		return super.toString();
	}

	public static String REF = "Infoclass";
	public static String PROP_INFOCLASS_STATUS = "infoclassStatus";
	public static String PROP_INFOCLASS_SORT_ID = "infoclassSortId";
	public static String PROP_INFOCLASS_NAME = "infoclassName";
	public static String PROP_ID = "id";
	private int hashCode;
	private String id;
	private String infoclassName;
	private Integer infoclassSortId;
	private Integer infoclassStatus;
	private Set informations;

}
